package com.moonlit.myspring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

/**
 * 关羽类
 */
@Component("guanyu")
public class GuanYu implements Hero {
    //创建一个武器的接口
    @Autowired
    @Qualifier("halberd")
    private Weapon weapon;

    public void setWeapon(Weapon weapon) {
        this.weapon = weapon;
    }

    public void perform() {
        System.out.println("GuanYu pick up his weapon kill everyone of dirty");
        weapon.attack();
    }
}
